package com.zby.CloudGallery.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zby.CloudGallery.model.dto.space.SpaceAddRequest;
import com.zby.CloudGallery.model.dto.space.SpaceQueryRequest;
import com.zby.CloudGallery.model.entity.SpaceEntity;
import com.zby.CloudGallery.model.entity.UserEntity;
import com.zby.CloudGallery.model.vo.SpaceVO;
import javax.servlet.http.HttpServletRequest;

/**
 * 空间
 *
 * @author zby
 * @email 2069189112@qq.com
 * @date 2025-02-13 22:01:11
 */
public interface SpaceService extends IService<SpaceEntity> {
    /**
     * 创建空间
     *
     * @param spaceAddRequest
     * @param loginUser
     * @return
     */
    long addSpace(SpaceAddRequest spaceAddRequest, UserEntity loginUser);

    /**
     * 校验空间
     *
     * @param space
     * @param add   是否为创建时检验
     */
    void validSpace(SpaceEntity space, boolean add);

    /**
     * 获取空间包装类（单条）
     *
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(SpaceEntity space, HttpServletRequest request);

    /**
     * 获取空间包装类（分页）
     *
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<SpaceEntity> spacePage, HttpServletRequest request);

    /**
     * 获取查询对象
     *
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<SpaceEntity> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     * 根据空间级别填充空间对象
     *
     * @param space
     */
    void fillSpaceBySpaceLevel(SpaceEntity space);

    /**
     * 校验空间权限
     *
     * @param loginUser
     * @param space
     */
    void checkSpaceAuth(UserEntity loginUser, SpaceEntity space);
}

